#include "htmlif.h"
#include "body.h"
#include "template.h"
#include "type.h"
#include "errorlog.h"

HtmlIf::HtmlIf(Node* expr, Body* body, HtmlIf* elseClause, const YYLTYPE& loc)
        : Namespace(loc), m_expr(expr), m_body(body), m_else(elseClause)
{
    if ( expr )
        appendChild( expr );
    appendChild( body );
    if ( m_else )
        appendChild(m_else);
}

void HtmlIf::setBodyTemplate( Template* t )
{
    m_bodyTemplate = t;
    appendChild(t);
}

void HtmlIf::resolveAll()
{
    this->liftNames();
    this->Namespace::resolveAll();

//    if ( m_expr && !m_expr->type().isScalar() )
//        ErrorLog::error( m_expr->location(), "The expression must be a scalar" );
}

Node* HtmlIf::getEntry( const QString& name )
{
    return getLiftedEntry(name);
}
